import execjs
import requests
js = open("out.js", 'r', encoding='utf-8').read()
ctx = execjs.compile(js)
# data = ctx.call("Music", 1958493948) # 歌曲
# data = ctx.call("Lyric", 1958493948) # 歌词
data = ctx.call("Search", "兰音") # 搜索
print(data)
headers={
    "Content-Type":"application/x-www-form-urlencoded",
	'User-Agent':'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36'
}

# json = requests.post("https://music.163.com/weapi/song/enhance/player/url/v1?csrf_token=",headers=headers,data=data).text # 歌直链
# json = requests.post("https://music.163.com/weapi/song/lyric?csrf_token=",headers=headers,data=data).text # 歌词
json = requests.post("https://music.163.com/weapi/cloudsearch/get/web?csrf_token=",headers=headers,data=data).text
print(json)